<script>
export default defineComponent({
  name: 'RowTableCell',
  props: {
    column: {
      type: Object,
      required: true,
    },
    node: {
      type: Object,
      required: true,
    },
  },
  setup(props) {
    return () => {
      const symbolIndex = inject('symbolIndex')
      const symbolLevel = inject('symbolLevel')
      const node = props.node
      const column = props.column
      const type = props.column.type
      const data = node.data
      const index = node[symbolIndex]
      const level = node[symbolLevel]
      return h(
        'div',
        {
          class: 'table-cell-label',
          onClick: () => {},
        },
        column.render
          ? column.render(h, { node, data, column, index, level }, node)
          : type === 'index'
            ? index
            : [data[column.key]]
      )
    }
  },
})
</script>
<style scoped lang="scss">
.table-cell-label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: keep-all;
}
</style>
